package com.bjsxt.web.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bjsxt.dao.CustomerDao;
import com.bjsxt.entity.Customer;

@SuppressWarnings("serial")
public class ListCustomer extends HttpServlet {

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		resp.setContentType("text/html;charset=utf-8");
		CustomerDao dao = new CustomerDao();
		List<Customer> list = dao.getCustomers();
		if(list != null){
			req.setAttribute("list", list);
			req.getRequestDispatcher("list.jsp").forward(req, resp);
		}
	}	
}
